#include "MyWidget.h"

MyWidget::MyWidget(QWidget *parent) : QWidget(parent){
    	
}

void MyWidget::center(){
    int x, y, screenWidth, screenHeight;

    QDesktopWidget *desktop = new QDesktopWidget();
    QRect screen = desktop->screenGeometry(-1);

    screenWidth = screen.width();
    screenHeight = screen.height();

    x = (screenWidth - width) / 2;
    y = (screenHeight - height) / 2;

    setGeometry(x, y, width, height);
}

void MyWidget::resize(int w, int h){
    width=w;
    height=h;
    QWidget::resize(width,height);
}

void MyWidget::show(){
    center();
    QWidget::show();
}

